package cn.tedu.spring.eg33;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Eglife {
    private String username;
    public Eglife(){
        System.out.println("1.调用无参构造实例化");
    }
@Value("中秋节")
    public void setUsername(String username) {
        this.username = username;
        System.out.println("2.调用set()方法进行属性赋值");
    }
    @PostConstruct
    public void init(){
        System.out.println("3.执行生命周期初始化方法");
    }
    @PreDestroy
    public void destory(){
        System.out.println("5.执行生命周期销毁方法");
    }
}
